package cn.ldh.controller;

import cn.ldh.domain.Product;
import cn.ldh.mapper.ProductMapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/product")
public class ProductController {

    @Resource
    private ProductMapper productMapper;

    @PostMapping("/add")
    public Product addProduct(@RequestBody Product product){
        productMapper.add(product);
        return product;
    }

    public Product blockHandlerProduct(@RequestBody Product product){
        productMapper.add(product);
        return product;
    }

}
